/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javaseapp - Reg1
 * <p>Powered by webrx On 2021-08-06 16:14:25
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Reg3 {
    public static void main(String[] args) {
        //正则表达式判断字符串内容，是中文汉字，还是英文
        String n = "中国";
        String p = "[\u4e00-\u9fa5\\s]+";
        String pen = "[a-zA-Z\\s]+";
        if (n.matches(p)) {
            System.out.println("中文");
        } else if (n.matches(pen)) {
            System.out.println("英文");
        } else {
            System.out.println("字符串未知格式");
        }
    }
}
